<?php
if($check->isAdmin()) {
	if ($_POST['addnews'])
	{
		$body = mysql_real_escape_string($_POST['body']);
		$title = mysql_real_escape_string($_POST['title']);
		$date = date("y-m-d");
		mysql_query("INSERT INTO news 
		(title, body, date, comments) VALUES('$title', '$body', '$date', '0') ") 
		or die(mysql_error());
		$result = 'Successfull! Added to news.';
	}
	$main = '			
			<table cellpadding="4" cellspacing="1" width="100%">
				<tr>
					<td>
						'.$result.'
						<form method="post" name="addnews" action="?page=addnews">

						<b>Title:</b><br />
						<input type="text" name="title" />
						<br />

						<b>Body:</b><br />
						<textarea name="body" cols="100" rows="6" onkeypress="javascript:return (this.value.length < 4096)"></textarea>
						<br />

						<input type="submit" value="Submit" name="addnews" />
						</form>
					</td>
				</tr>
			</table>';
} else {
	$main = 'You are not adminstrator!';
}
?>